<!DOCTYPE html>
<html lang="zh-Hans-CN">
<head>
    <meta charset="UTF-8">
    <title>template模板</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../vue.js"></script>
</head>
<body>
<h2>【例27】template模板:Vue提供了template标签编写组件结构</h2>
<hr>
<div id="app">
    <p>{{title}}</p>
    <my-component></my-component>
</div>

<template id="tmp1">
    <p>Vue的模板。组件中标题：{{title}}</p>
</template>

<script>
    Vue.component('my-component', {
        template: '#tmp1',
        data() {
            return {
                title: '我是组件内的title',
            }
        }
    });
    let vm = new Vue({
        el: '#app',
        data: {
            title: '我是vm实例的title'
        }
    })
</script>
<hr>
<p><a href="index.html">返回章节目录</a>
    <script>document.write(document.lastModified); </script>
</p>
</body>
</html>
